<?php
/**
 * ShopEx licence
 *
 * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
 * @license  http://ecos.shopex.cn/ ShopEx License
 */


class b2c_mdl_goods_opinions_praise extends dbeav_model{

	/**
	 * 构造方法
	 * @param object model相应app的对象
	 * @return null
	 */
    public function __construct($app){
        parent::__construct($app);
//        $this->use_meta();
    }
//    var $subSdf = array(
//        'default' => array(
//            'goods_id' => array('name'),
//            'user_id' => array('name')
//        )   
//    );
	/**
	 * 保存的方法
	 * @param mixed 保存的数据内容
	 * @return boolean
	 */
    public function save(&$aData){
        //判断user_id是否是会员id
        //判断goods_id是否是商品id
        if(parent::save($aData)){
            return true;
        }else{
            return false;
        }
    }

    function get_list($cols='*', $filter=array(), $offset=0, $limit=-1, $orderType=null){
        
        $filters = $filter;
        $list = $this->getList($cols,$filters,$offset,$limit,$orderType);
 //       var_dump($list);exit;
        foreach($list as $key=>$val){
            $list[$key]['created'] =  date("Y-m-d H:i:s",$val['created']) ;
            $member = app::get("b2c")->model("members")->getRow("*",array('member_id'=>$val['member_id']));
            $list[$key]['name'] = $member['name'];
            $list[$key]['avatar'] = base_storager::image_path($member['avatar'],'s');
            $list[$key]['member_lv_id'] = $member['member_lv_id'];
            $list[$key]['opinions_num'] = $member['opinions_num'];
            $list[$key]['fans_num'] = $member['fans_num'];
            $list[$key]['praise_num'] = $member['praise_num'];
        }
        return $list;
    }


//
//    function toRemove($id,&$msg=''){
//        parent::update(array('status' => 'del'),array('opinions_id'=>intval($id)));
//        return true;
//    }



}
